<template>
    <div>
      <!--店铺卡片:循环-->
      <el-card class="box-card" :body-style="{ padding: '0px' }" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="text">{{ restaurant.restaurantName }}</span>
        </div>
        <el-row>
          <el-col :span="4">
            <div>
              <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
            </div>
          </el-col>
          <el-col :span="20">
            <div style="padding: 14px;">
              <span class="text">{{ restaurant.description }}</span>
              <div class="bottom clearfix">
                <time class="time text">{{ desc }}</time>
                <span class="time">{{ restaurant.address }}</span>
                <el-button type="text" v-if="this.enterButton" class="button" @click="toRestaurantInfo(restaurant.id)">进入店铺</el-button>
              </div>
            </div>
          </el-col>
        </el-row>
      </el-card>
    </div>
</template>

<script>
    export default {
        name: "RestaurantCard",
      props: {
        restaurant: {},
        // 是否显示进入店铺按钮
        enterButton: {
          type: Boolean,
          default: true
        }
      },
      data(){
        return {
          desc: '',
        }
      },
      methods: {
        toRestaurantInfo: function (restId) {
          console.log("to Restaurant info" + restId);
          this.$router.push({name: 'restaurantInfo', params: {shopId: restId}});

        }
      }
    }
</script>

<style scoped>
  .image {
    width: 100px;
    display: block;
  }
</style>
